'use strict';
var yeoman = require('yeoman-generator');
var chalk = require('chalk');
var yosay = require('yosay');

module.exports = yeoman.Base.extend({
  constructor: function () {
    // Calling the super constructor is important so our generator is correctly set up
    yeoman.Base.apply(this, arguments);

    this.helperMethod = function () {
      this.log('won\'t be called automatically');
    };
  },
  prompting: function () {
    // Have Yeoman greet the user.
    this.log(yosay(
      'Welcome to the magnificent ' + chalk.red('generator-ryanfirst') + ' generator!'
    ));

    var prompts = [{
      type: 'confirm',
      name: 'someAnswer',
      message: 'Would you like to enable this option?',
      default: true
    },{
      type:'input',
      name:'name',
      message:'hi,what is your name?',
      default:this.appname
    }];

    return this.prompt(prompts).then(function (props) {
      // To access props later use this.props.someAnswer;
      this.props = props;
      this.log("名称是",props.name);
    }.bind(this));
  },

  writing: function () {
    this.fs.copy(
      this.templatePath('dummyfile.txt'),

      this.destinationPath('dummyfile.txt')
    );
    this.fs.copy(this.templatePath("test"),this.destinationPath('app/test'));
   // this.copy("package.json","package.json")
  },

  install: function () {
    this.installDependencies();
  },
  end:function () {
    this.log("最后的处理");
  },
  method1: function () {
    this.log('method 1 just ran');
  }
});
